package com.blog.wu.myblog.config;

import com.blog.wu.myblog.base.BaseService;
import com.blog.wu.myblog.entity.UserInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author wuyanshen
 * @Date 2018-10-17 下午1:50
 * @Discription 请求监听器（暂时没用到）
 */
//@WebListener
public class WebRequestListener extends BaseService implements ServletRequestListener{


    @Override
    public void requestDestroyed(ServletRequestEvent servletRequestEvent) {
//        logger.info("request请求销毁");
    }

    @Override
    public void requestInitialized(ServletRequestEvent servletRequestEvent) {
//        logger.info("request请求创建");
//        HttpServletRequest request = (HttpServletRequest) servletRequestEvent.getServletRequest();
//        String id = request.getSession().getId();
//        logger.info("sessionId = {}",id);
//        // 客户端ip
//        String ip = request.getRemoteAddr();
//        // 访问的URL地址
//        String url = request.getRequestURI();
//        // 只做简单后台打印
//        logger.info("The client ip is " + ip);
//        logger.info("The address url is " + url);
    }
}
